package com.leyou.config;

import com.leyou.auth.utils.RsaUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;

import javax.annotation.PostConstruct;
import java.io.File;
import java.security.PrivateKey;
import java.security.PublicKey;

/**
 * @Author: wzh
 * @Date: 2019/4/12 20:43
 * @Description:
 */
@Slf4j
@ConfigurationProperties(prefix = "ly.jwt")
@Data
public class JwtProperties {


    private String pubKeyPath;//公钥路径
    private String cookieName; //cookie名称

    private PublicKey publicKey; // 公钥


    //对象实例化之后，获取公钥和私钥
    @PostConstruct
    public void init() throws Exception{

        this.publicKey = RsaUtils.getPublicKey(pubKeyPath);
    }
}
